﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SimpleRadar
{
    public class CanvasEx:Canvas
    {
        public void drawLine(Point a,Point b,SolidColorBrush color)
        {
            Line line = new Line();
            line.Stroke = color;
            line.X1 = a.X;
            line.Y1 = a.Y;
            line.X2 = b.X;
            line.Y2 = b.Y;
            this.Children.Add(line);
        }
        public void drawLine(Point a, Point b)
        {
            Line line = new Line();
            line.Stroke = new SolidColorBrush(Colors.Black);
            line.X1 = a.X;
            line.Y1 = a.Y;
            line.X2 = b.X;
            line.Y2 = b.Y;
            this.Children.Add(line);
        }
        public void drawCircler(Point angle,int size,SolidColorBrush color)
        {
            Ellipse elip = new Ellipse();
            elip.Stroke = color;
            elip.Margin = new Thickness(angle.X, angle.Y, 0, 0);
            elip.Width = size;
            elip.Height = size;
            this.Children.Add(elip);
        }
        public void drawQuarterCircle(Point angle,Point startPoint,Point Arc,int Size)
        {
            PathFigure pthFigure1 = new PathFigure();
            pthFigure1.StartPoint = startPoint;// starting cordinates of arcs
            ArcSegment arcSeg1 = new ArcSegment();
            arcSeg1.Point = Arc;   // ending cordinates of arcs
            arcSeg1.Size = new Size(Size, Size);

            arcSeg1.IsLargeArc = false;
            arcSeg1.SweepDirection = SweepDirection.Clockwise;
            arcSeg1.RotationAngle = 20;
            PathSegmentCollection myPathSegmentCollection1 = new PathSegmentCollection();
            myPathSegmentCollection1.Add(arcSeg1);
            LineSegment lineSeg = new LineSegment();
            /**/
            lineSeg.Point = angle;
            myPathSegmentCollection1.Add(lineSeg);
            pthFigure1.Segments = myPathSegmentCollection1;


            PathFigureCollection pthFigureCollection1 = new PathFigureCollection();
            pthFigureCollection1.Add(pthFigure1);

            PathGeometry pthGeometry1 = new PathGeometry();
            pthGeometry1.Figures = pthFigureCollection1;
            System.Windows.Shapes.Path arcPath1 = new System.Windows.Shapes.Path();
            arcPath1.Data = pthGeometry1;
            arcPath1.Fill = new SolidColorBrush(Colors.Green);
            this.Children.Add(arcPath1);
        }
    }
}
